<?php

/**
 *  后台继承类
 * @file   Admin.php  
 * @date   2016-8-23 19:45:21 
 * @author Zhenxun Du<5552123@qq.com>  
 * @version    SVN:$Id:$ 
 */
namespace app\admin\controller;

use think\Loader;

class Valuation extends Common {
    public $securitie;
    public function _initialize(){
        $this->securitie = new \app\admin\model\Securities();
    }

    public function index() {

        $list = $this->securitie->securitieList(['status'=>8]);
        $this->assign('lists', $list);
        return $this->fetch();
     }

    //列表
    public function info() {

        $id = input('sid');
        if ($id) {
            //当前用户信息
            $info = db('securities')->where(['sid'=>$id])->find();
            $this->assign('info', $info);
        }
        return $this->fetch();
    }

    //添加
    public function add() {
        $data = input();
        if (!$data['stock_code']) {
            $this->error('编号不能为空');
        }

        $reVal = 1;
        $reVal = $this->securitie->SecuritieInfo($data);
        if($reVal == 1){
            $this->success('操作成功', url('index'));
        }else{
            $this->error('操作失败');
        }
    }

    //详情
    public function detail(){

        $sid = input('sid');
        $stock_code = input('stock_code');
        $reVal = [];
        $reVal = $this->securitie->detailCompanyInfo($sid, $stock_code);

        $this->assign('stock_lists', $reVal);
        return $this->fetch();
    }

    //删除
    public function del() {

        $data = input();
        $this->securitie->securitieInfoUpdate($data['sid'], $data['stock_code'],['status'=>$data['status']]);
        $this->success('操作成功', url('index'));
    }
}